{include file='../library/header.lbi'}
<div class="layui-fluid">
	<div class="layui-card">
		<form name="searchfrm" action="/members/index" method="GET" id="searchfrm" class="layui-form layui-card-header layuiadmin-card-header-auto">
			<div class="layui-input-inline w120">
				<select name="category">
					<option value="">选择类型</option>
					<option value="account" {if $ver.category eq 'account'}selected{/if}>帐号</option>
					<option value="name" {if $ver.category eq 'name'}selected{/if}>姓名</option>
					<option value="mobile" {if $ver.category eq 'mobile'}selected{/if}>手机</option>
					<option value="email" {if $ver.category eq 'email'}selected{/if}>邮箱</option>
				</select>
			</div>
			<div class="layui-input-inline">：
			</div>
			<div class="layui-input-inline">
				<input type='text' name='category_val' value="{if $ver.category_val}{$ver.category_val}{/if}" class="layui-input" placeholder="关键字">
			</div>
			<div class="layui-input-inline w150">
				<select name="group_id">
					<option value="">选择权限组</option>
					{foreach from=$groups item=item}
					<option value="{$item.id}" {if $ver.group_id eq $item.id}selected{/if}>{$item.name}</option>
					{/foreach}
				</select>
			</div>
			<div class="layui-input-inline">入职时间：</div>
			<div class="layui-input-inline">
				<input type='text' name='date_start' value="{$ver.date_start}" class="layui-input layui-date">
			</div>
			<div class="layui-input-inline">
				-
			</div>
			<div class="layui-input-inline">
				<input type='text' name='date_end' value="{$ver.date_end}" class="layui-input layui-date">
			</div>
			<div class="layui-input-inline">
				<button class="layui-btn layuiadmin-btn-list" id="search">
					<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
				</button>
				<button class="layui-btn layuiadmin-btn-list" type="reset">
					重置
				</button>
			</div>
		</form>
		<div class="layui-card-body">
			<div style="padding-bottom: 10px;">
				<button class="layui-btn layuiadmin-btn-list" onclick="iframe_box('/members/add','添加','800','600');">添加</button>
			</div>
			<table class="layui-table">
				<thead>
					<tr>
						<th class="wb5">ID</th>
						<th>帐号</th>
						<th>姓名</th>
						<th>手机</th>
						<th>邮箱</th>
						<th>入职时间</th>
						<th>权限组</th>
						<th class="wb10">操作</th>
					</tr>
				</thead>
				{if $result.rows} {foreach from=$result.rows item=item}
				<tr data-id="{$item.id}">
					<td>{$item.id}</td>
					<td>{$item.account}</td>
					<td>{$item.name}</td>
					<td>{$item.mobile}</td>
					<td>{$item.email}</td>
					<td>{if $item.entry_time}{$item.entry_time|date_format:'%Y-%m-%d'}{/if}</td>
					<td>{$item.group_name}</td>
					<td>
						<div class="layui-table-cell laytable-cell-2-8">
							<a class="layui-btn layui-btn-normal layui-btn-xs J_edit" lay-event="edit"><i class="layui-icon layui-icon-edit" ></i>编辑</a>
							<a class="layui-btn layui-btn-danger layui-btn-xs J_del" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
						</div>
					</td>
				</tr>
				{/foreach} {/if}
			</table>
			<div class="clearfix">
				<div class="fn-left">
				</div>
				<div class="fn-right clearfix" id="page" total="{$result.count}" curr="{$result.page}" limit="{$result.pagesize}">
				</div>
			</div>
		</div>
	</div>
</div>
{literal}
<script type="text/javascript">
$(document).ready(function() {
	$(".J_edit").click(function() {
		var _id = $(this).parent().parent().parent().attr('data-id');
		iframe_box('/members/add/id/' + _id, '编辑', '800', '600');
	})

	$("#search").click(function() {
		$("#searchfrm").submit();
	});
	$(".J_del").click(function() {
		var _this = $(this);
		layer.confirm('确定要删除吗？', { icon: 3, title: '删除提示' }, function(index) {
			var _id = _this.parent().parent().parent().attr('data-id');
			$.ajax({
				type: "POST",
				url: "/members/del",
				dataType: 'json',
				data: "id=" + _id,
				success: function(res) {
					if (res.code == 200) {
						layer.msg('删除成功', {
							offset: 'auto',
							icon: 1,
							time: 1000
						}, function() {
							location.reload();
						});
					} else {
						layer.msg('删除失败!');
					}
				},
				error: function() {
					layer.msg('网络异常，操作失败!');
				}
			});
		})
	})
})
</script>
{/literal} {include file='../library/footer.lbi'}